package CCF_2013;

import java.util.Scanner;

public class T201312_3 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();
        scanner.close();
        int count = Integer.valueOf(str1);
        int nums[] = StringToInt(str2.split(" "));
        long maxArea = 0;
        int k=1;
        for (int i=0;i<count;i++) {
            if (i>0 && nums[i]==nums[i-1])
                continue;
            for (int l=i-1;l>=0;l--) {
                if (nums[l]>=nums[i])
                    k++;
                else
                    break;
            }
            for (int r=i+1;r<count;r++) {
                if (nums[r] >= nums[i])
                    k++;
                else
                    break;
            }
            if (k*nums[i] > maxArea)
                maxArea = k*nums[i];
            k=1;
        }
        System.out.println(maxArea);
    }

    private static int[] StringToInt(String[] ss) {
        int[] array = new int[ss.length];
        for(int i=0;i<ss.length;i++) {
            array[i] = Integer.valueOf(ss[i]);
        }
        return array;
    }

}
